

<template>


  <div class="app-container">

  <div class="container" >
     <el-row :gutter="10" width="100%" aria-setsize="10">
       <h1>订单信息</h1>
     </el-row>
    <el-row :gutter="10">
      <el-col :span="6"><div class="grid-content bg-purple">订单状态 :待计划  </div></el-col>
      <el-col :span="6"><div class="grid-content bg-purple">生产订单编号:GD20231002101</div></el-col>
      <el-col :span="6"><div class="grid-content bg-purple">客户名称:广汇商贸</div></el-col>
      <el-col :span="6"><div class="grid-content bg-purple">销售单号:PO20170725022</div></el-col>
    </el-row> <br>
    <el-row :gutter="10">
      <el-col :span="6"><div class="grid-content bg-purple">订单来源:系统新增  </div></el-col>
      <el-col :span="6"><div class="grid-content bg-purple">备注:-</div></el-col>

    </el-row><br>
    <el-row :gutter="10">
      <el-col :span="6"><div class="grid-content bg-purple">创建时间:2020/09/01 10:40  </div></el-col>
      <el-col :span="6"><div class="grid-content bg-purple">创建人:林敏儿</div></el-col>
      <el-col :span="6"><div class="grid-content bg-purple">最后更新时间:2020/09/01 10:40 </div></el-col>
      <el-col :span="6"><div class="grid-content bg-purple">最后更新人:林敏儿</div></el-col>
    </el-row>

  </div>
    <template>
      <div class="app-container">
        <el-row :gutter="10" width="100%" aria-setsize="10">
          <h1>产品信息</h1>
        </el-row>
        <el-row :gutter="1">
          <el-col :span="60"><div class="grid-content bg-purple">  <el-table v-loading="loading" :data="giveList" @selection-change="handleSelectionChange">
            <el-table-column type="selection" width="55" align="center" />
            <el-table-column label="序号" align="center" prop="giveId" />
            <el-table-column label="产品编码" align="center" prop="productCode" />
            <el-table-column label="产品名称" align="center" prop="productName" />
            <el-table-column label="规格" align="center" prop="specification" />
            <el-table-column label="计量单位" align="center" prop="unit" />
            <el-table-column label="计划产量" align="center" prop="plannedQuantity" />
            <el-table-column label="交付日期" align="center" prop="deliveryDate" width="180">
              <template slot-scope="scope">
                <span>{{ parseTime(scope.row.deliveryDate, '{y}-{m}-{d}') }}</span>
              </template>
            </el-table-column>

          </el-table></div></el-col>
        </el-row>



      </div>
    </template>

    <el-row :gutter="10" width="100%" aria-setsize="10">
      <h1>关联生产计划</h1>
    </el-row>


    <el-table v-loading="loading" :data="planList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="序号" align="center" prop="planId" />
      <el-table-column label="生产计划编号" align="center" prop="planNumber" />
      <el-table-column label="计划状态" align="center" prop="planStatus">
        <template slot-scope="scope">
          <span v-if="scope.row.planStatus==1">未排程</span>
          <span v-if="scope.row.planStatus==2">已排程</span>

        </template>
      </el-table-column>
      <el-table-column label="优先级" align="center" prop="orderLevel">
        <template slot-scope="scope">
          <span v-if="scope.row.orderLevel==1">普通</span>
          <span v-if="scope.row.orderLevel==2">紧急</span>
          <span v-if="scope.row.orderLevel==3">非常紧急</span>
        </template>
      </el-table-column>
      <el-table-column label="产品编码" align="center" prop="productCode" />
      <el-table-column label="产品名称" align="center" prop="productName" />
      <el-table-column label="计量单位" align="center" prop="unit" />
      <el-table-column label="规格" align="center" prop="specification" />
      <el-table-column label="计划产量" align="center" prop="plannedProduction" />
      <el-table-column label="报工数量" align="center" prop="reportedQuantity" />
      <el-table-column label="销售单号" align="center" prop="salesSell" />
      <el-table-column label="交付日期" align="center" prop="deliveryDate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.deliveryDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="工艺" align="center" prop="craftId" >
        <template slot-scope="scope">
          <span v-if="scope.row.craftId==1">
焊接加工通用工艺</span>
          <span v-if="scope.row.craftId==2">包装工艺010</span>
          <span v-if="scope.row.craftId==3">清洗通用工艺003</span>
        </template>
      </el-table-column>
      <el-table-column label="车间 " align="center" prop="shopId" >
        <template slot-scope="scope">
          <span v-if="scope.row.shopId==1">
机械制造车间</span>
          <span v-if="scope.row.shopId==2">包装车间</span>
          <span v-if="scope.row.shopId==3">组装车间</span>
        </template>
      </el-table-column>
      <el-table-column label="生产线" align="center" prop="productId">
        <template slot-scope="scope">
          <span v-if="scope.row.productId==1">
机械加工生产线A</span>
          <span v-if="scope.row.productId==2">机械加工生产线B</span>
          <span v-if="scope.row.productId==3">机械加工生产线C</span>
        </template>
      </el-table-column>
      <el-table-column label="计划开始日期" align="center" prop="startdate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.startdate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="计划结束日期" align="center" prop="denddate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.denddate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="
实际开始日期" align="center" prop="artdate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.artdate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="计划结束日期" align="center" prop="enddate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.enddate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="创建人" align="center" prop="creator" />
      <el-table-column label="创建日期" align="center" prop="creationTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.creationTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>

    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改关联生产计划对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="生产计划编号" prop="planNumber">
          <el-input v-model="form.planNumber" placeholder="请输入生产计划编号" />
        </el-form-item>
        <el-form-item label="优先级" prop="orderLevel">
          <el-input v-model="form.orderLevel" placeholder="请输入优先级" />
        </el-form-item>
        <el-form-item label="产品编码" prop="productCode">
          <el-input v-model="form.productCode" placeholder="请输入产品编码" />
        </el-form-item>
        <el-form-item label="产品名称" prop="productName">
          <el-input v-model="form.productName" placeholder="请输入产品名称" />
        </el-form-item>
        <el-form-item label="计量单位" prop="unit">
          <el-input v-model="form.unit" placeholder="请输入计量单位" />
        </el-form-item>
        <el-form-item label="规格" prop="specification">
          <el-input v-model="form.specification" placeholder="请输入规格" />
        </el-form-item>
        <el-form-item label="计划产量" prop="plannedProduction">
          <el-input v-model="form.plannedProduction" placeholder="请输入计划产量" />
        </el-form-item>
        <el-form-item label="报工数量" prop="reportedQuantity">
          <el-input v-model="form.reportedQuantity" placeholder="请输入报工数量" />
        </el-form-item>
        <el-form-item label="销售单号" prop="salesSell">
          <el-input v-model="form.salesSell" placeholder="请输入销售单号" />
        </el-form-item>
        <el-form-item label="交付日期" prop="deliveryDate">
          <el-date-picker clearable
            v-model="form.deliveryDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择交付日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="工艺" prop="craftId">
          <el-input v-model="form.craftId" placeholder="请输入工艺" />
        </el-form-item>
        <el-form-item label="车间" prop="shopId">
          <el-input :v-model="form.shopId" placeholder="请输入车间" />
        </el-form-item>
        <el-form-item label="生产线"  prop="productId">
          <el-input v-model="form.productId" placeholder="请输入生产线" />
        </el-form-item>
        <el-form-item label="计划开始日期" prop="startdate">
          <el-date-picker clearable
            v-model="form.startdate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择计划开始日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="计划结束日期" prop="denddate">
          <el-date-picker clearable
            v-model="form.denddate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择计划结束日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="
实际开始日期" prop="artdate">
          <el-date-picker clearable
            v-model="form.artdate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择
实际开始日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="计划结束日期" prop="enddate">
          <el-date-picker clearable
            v-model="form.enddate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择计划结束日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="创建人" prop="creator">
          <el-input v-model="form.creator" placeholder="请输入创建人" />
        </el-form-item>
        <el-form-item label="创建日期" prop="creationTime">
          <el-date-picker clearable
            v-model="form.creationTime"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择创建日期">
          </el-date-picker>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>






<template>
  <div class="app-container">


    <el-row :gutter="10" width="100%" aria-setsize="10">
      <h1>关联工单</h1>
    </el-row>

  <el-table v-loading="loading" :data="workList" @selection-change="handleSelectionChange">
    <el-table-column type="selection" width="55" align="center" />
    <el-table-column label="序号" align="center" prop="id" />
    <el-table-column label="工单编号" align="center" prop="worko" />
    <el-table-column label="工单状态" align="center" prop="pend" />
    <el-table-column label="计划开始日期" align="center" prop="startdate" width="180">
      <template slot-scope="scope">
        <span>{{ parseTime(scope.row.startdate, '{y}-{m}-{d}') }}</span>
      </template>
    </el-table-column>
    <el-table-column label="计划结束日期" align="center" prop="denddate" width="180">
      <template slot-scope="scope">
        <span>{{ parseTime(scope.row.denddate, '{y}-{m}-{d}') }}</span>
      </template>
    </el-table-column>
    <el-table-column label="优先级" align="center" prop="orderLevel" >
      <template slot-scope="scope">
        <span v-if="scope.row.orderLevel==1">普通</span>
        <span v-if="scope.row.orderLevel==2">紧急</span>
        <span v-if="scope.row.orderLevel==3">非常紧急</span>
      </template>
    </el-table-column>
    <el-table-column label="产品名称" align="center" prop="productName" />
    <el-table-column label="产品编码" align="center" prop="productCode" />
    <el-table-column label="物料类型" align="center" prop="materialtype" />
    <el-table-column label="制造方式" align="center" prop="method" />
    <el-table-column label="计量单位" align="center" prop="unit" />
    <el-table-column label="规格" align="center" prop="specification" />
    <el-table-column label="计划产量" align="center" prop="plannedQuantity" />
    <el-table-column label="完成数量" align="center" prop="pleted" />
    <el-table-column label="车间" align="center" prop="shopId" />
    <el-table-column label="生产线" align="center" prop="productId" />
    <el-table-column label="工艺" align="center" prop="craftId" />
    <el-table-column label="当前工序" align="center" prop="proces" />
    <el-table-column label="订单来源" align="center" prop="dersders" />
    <el-table-column label="生产订单号" align="center" prop="orderId" />
    <el-table-column label="交付日期" align="center" prop="deliveryDate" width="180">
      <template slot-scope="scope">
        <span>{{ parseTime(scope.row.deliveryDate, '{y}-{m}-{d}') }}</span>
      </template>
    </el-table-column>
    <el-table-column label="销售单号" align="center" prop="orderSell" />
    <el-table-column label="备注" align="center" prop="remark" />
    <el-table-column label="实际开始日期" align="center" prop="artdate" width="180">
      <template slot-scope="scope">
        <span>{{ parseTime(scope.row.artdate, '{y}-{m}-{d}') }}</span>
      </template>
    </el-table-column>
    <el-table-column label="实际结束日期" align="center" prop="enddate" width="180">
      <template slot-scope="scope">
        <span>{{ parseTime(scope.row.enddate, '{y}-{m}-{d}') }}</span>
      </template>
    </el-table-column>
    <el-table-column label="创建人" align="center" prop="creator" />
    <el-table-column label="创建时间" align="center" prop="creationTime" width="180">
      <template slot-scope="scope">
        <span>{{ parseTime(scope.row.creationTime, '{y}-{m}-{d}') }}</span>
      </template>
    </el-table-column>

  </el-table>

  <pagination
    v-show="total>0"
    :total="total"
    :page.sync="queryParams.pageNum"
    :limit.sync="queryParams.pageSize"
    @pagination="getList"
  />
    <!-- 操作按钮 -->
    <div class="bottom-buttons">
      <el-button @click="cancel">取消</el-button>
      <el-button type="primary" @click="saveOrder">创建生产计划</el-button>
    </div>
  </div>


</template>


  </div>

</template>








<script>
import { listPlan, getPlan, delPlan, addPlan, updatePlan } from "@/api/order/plan";
import {listWork} from "@/api/order/work";
import {listGive} from "@/api/order/give";

export default {
  name: "Plan",
  data() {
    return {


      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 关联生产计划表格数据
      planList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        planNumber: null,
        planStatus: null,
        orderLevel: null,
        productCode: null,
        productName: null,
        unit: null,
        specification: null,
        plannedProduction: null,
        reportedQuantity: null,
        salesSell: null,
        deliveryDate: null,
        craftId: null,
        shopId: null,
        productId: null,
        startdate: null,
        denddate: null,
        artdate: null,
        enddate: null,
        creator: null,
        creationTime: null,

        giveList: [],

        // 关联工单表格数据
        workList: [],

      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
      }
    };
  },
  created() {
    this.getLists();
    this.getList();
    this.getListgive()
  },
  methods: {
//返回上一页
    cancel() {
      this.$router.go(-1);
    },
    saveOrder() {
      location.href = '/work'
    },

    /** 查询关联生产计划列表 */
    getList() {
      this.loading = true;
      listPlan(this.queryParams).then(response => {
        this.planList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },

    /** 查询关联工单列表 */
    getLists() {
      this.loading = true;
      listWork(this.queryParams).then(response => {
        this.workList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },

    getListgive() {
      this.loading = true;
      listGive(this.queryParams).then(response => {
        this.giveList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },


  }
};



</script>









<style>
.el-row {
  margin-bottom: 20px;
  &:last-child {
    margin-bottom: 0;
  }
}
.el-col {
  border-radius: 4px;
}
.bg-purple-dark {
  background: #99a9bf;
}
.bg-purple {
  background: #d3dce6;
}
.bg-purple-light {
  background: #e5e9f2;
}
.grid-content {
  border-radius: 4px;
  min-height: 36px;
}
.row-bg {
  padding: 10px 0;
  background-color: #f9fafc;
}
</style>
